import asyncio


def my_callback(future):
    print('返回值：', future.result())


async def coroutine_example(name):
    print('开始任务：', name)
    await asyncio.sleep(1)
    print('执行完毕：', name)
    return '返回值：' + name


loop = asyncio.get_event_loop()
tasks = []
for i in range(3):
    task = loop.create_task(coroutine_example('task_' + str(i)))
    task.add_done_callback(my_callback)
    tasks.append(task)

wait_coro = asyncio.wait(tasks)
loop.run_until_complete(wait_coro)

loop.close()
